<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script language="javascript" type="text/javascript"
		src="../script/datetimepicker.js"></script>
<script type="text/JavaScript"> 
	function confirmDelete(){
		return confirm("Are you sure you want to delete?");	
	}
</script>
<link href="<c:url value='/css/main.css'/>" rel="stylesheet" type="text/css"/>
<fmt:setBundle basename="ApplicationResources" />
<title> <fmt:message key="title.scheduleList"/> </title>
</head>
<body>
      <form action="${pageContext.request.contextPath}/controller/crudschedule"
		method=post>
		<h2>
			<fmt:message key="title.crudschedule" />
		</h2>
		<c:url var="url" scope="page" value="/pages/setupschedule.jsp">
		 	<c:param name="name" value="" />
			<c:param name="description" value="" />
			<c:param name="duration" value="" />
			<c:param name="insert" value="true" />
		</c:url>
		
		<a href="${url}"><fmt:message key="label.crudschedule.add" />
		</a> <br />
		<br />
		<table >

		<table class="borderAll" >

			<tr>
				<td><input id="date" name="date" type="text" size="25"
						value="12-09-2012" readonly="readonly"> <a
						href="javascript:NewCal('date','ddmmyyyy')"><img src="../img/cal.gif"
							width="16" height="16" border="0" alt="Pick a date"> </a></td>
			</tr>
			<tr >
				<td colspan="2" align="center"><input type="submit" value="Submit"> &nbsp;&nbsp;&nbsp;&nbsp;
				<input type="reset" value="Reset"></td>
			</tr>
		</table>
	</form>
	
	<c:if test="${sessionScope.user.roles[0].role!=null}">
		<c:forEach var="scheduleList" items="${weeklySchedule}" varStatus="rowCounter">
			<table class="borderAll">
	            <tr>
	                <th><fmt:message key="label.userList.id"/></th>
	                <th><fmt:message key="label.userList.name"/></th>
	                <th><fmt:message key="label.userList.role"/></th>
	            </tr>
	            <c:forEach var="programSlot" items="${scheduleList.programSlotList}" varStatus="status">
	                <tr>
	                	<td class="nowrap">${userList.id}</td>
	                    <td class="nowrap">${userList.name}</td>
	                    <td class="nowrap">
	                        <a href="${updurl}"><fmt:message key="label.userList.edit"/></a>
	                        &nbsp;&nbsp;&nbsp;
	                        <c:url var="delurl" scope="page" value="/controller/deleteuser">
	                            <c:param name="id" value="${userList.id}"/>
	                        </c:url>
	                        <a href="${delurl}" onClick="return confirmDelete();"><fmt:message key="label.userList.delete"/></a>
	                    </td>                    
	                </tr>
	            </c:forEach>
	        </table>
        </c:forEach>
	</c:if>
       
</body>
</html>